var mysql = require('mysql');

var pool = mysql.createPool({
	user : 'root',
    password : '',
    database : 'book'
});

pool.getConnection(function(err, connection){
	if(err){
		console.log(err.message);
		connection.release();
		return;
	}
	connection.query('insert into link_(name,info,url,add_time) values(\'node.js\',\'delete nodejs site\',\'http://nodejs.org\',sysdate())', function(err, rows, field){
		if(err){
			console.log(err.message);
			connection.release();
			return;
		}
		//console.log('ID:' + rows.insertId);
		connection.query('delete from link_ where id = ' + rows.insertId);
		console.log('delete success');
		connection.release();
		pool.end();
	});
});

